window.addEventListener('load', function () {
    var swiper = new Swiper('.swiper1', {
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: {
            delay: 2000,
            disableOnInteraction: false,
        },
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
    });
    var swiper2 = new Swiper('.swiper2', {
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: {
            delay: 4000,
            disableOnInteraction: false,
        },
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
    });
    var as = document.querySelectorAll('.banner_left_1 ul li a');
    for (var i = 0; i < as.length; i++) {
        as[i].onmousemove = function () {
            for (var i = 0; i < as.length; i++) {
                as[i].className = '';
            }
            this.className = 'banner_leftspanhover'
        }
    }
    var specialproduct_left_lis = document.querySelectorAll(".specialproduct_left ul li");
    var specialproduct_left_lis_span = document.querySelectorAll(".specialproduct_left ul li a span");
    var specialproduct_left_lis_i = document.querySelectorAll(".specialproduct_left ul li a i");
    console.log(specialproduct_left_lis);
    for (var j = 0; j < specialproduct_left_lis.length; j++) {
        specialproduct_left_lis[j].setAttribute('index', j);
        specialproduct_left_lis[j].onmouseover = function () {
            for (var j = 0; j < specialproduct_left_lis.length; j++) {
                specialproduct_left_lis_span[j].style.color = "#757575"
                specialproduct_left_lis_i[j].style.color = "#757575"
            }
            var specialproduct_left_lis_index = this.getAttribute('index');
            specialproduct_left_lis_span[specialproduct_left_lis_index].style.color = "#ffffff"
            specialproduct_left_lis_i[specialproduct_left_lis_index].style.color = "#ffffff"
        }
    }


    //侧边栏
    var banner = document.querySelector(".banner");
    var bannerTop = banner.offsetTop;
    var ce = document.querySelector(".cebianlan")
    var ceTop = ce.offsetTop - bannerTop;
    console.log(ceTop);

    document.addEventListener('scroll', function () {
        if (window.pageYOffset >= bannerTop) {
            ce.style.position = 'fixed';
            ce.style.top = ceTop + 'px';
        }
        else {
            ce.style.position = 'absolute';
            ce.style.top = 300 + 'px';
        }
    })

})